#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cstring>
#define endl "\n"
using namespace std;
const long long mod=1000000007;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	long long a=2,n,mun=1;//long long
	cin>>n;
	while(n)
	{
		if(n&1)
		{
			mun=mun*a%mod;
		}	
		a=a*a%mod;
		n=n/2;
	}	
	mun=(mun%mod)*((mun+1)%mod);
	mun=mun%mod/2;
	cout<<mun<<endl;
	return 0;
}